package ro.dta.idbi.patterns.tests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import uk.ac.ic.doc.automed.IntegrityException;
import uk.ac.ic.doc.automed.NotFoundException;
import uk.ac.ic.doc.automed.reps.Schema;

/**
 * Test suite for the patterns package
 * 
 * @author Tudor Dobrila
 */
@RunWith(Suite.class)
@Suite.SuiteClasses({ NormaliseTest.class, NormaliseRevTest.class, RenameTest.class,
		ColGenerTest.class, ColGenerRevTest.class, ColToTableTest.class, ColToTableRevTest.class,
		TableGenerTest.class, TableGenerRevTest.class, ColSubtypeTest.class,
		ColSubtypeRevTest.class, ColToSupertypeTest.class, ColToSupertypeRevTest.class,
		AddSubsetTest.class, AddIntersectionTest.class, AddPrimitiveTest.class,
		AddRelationOTMTest.class, AddRelationMTMTest.class, RedundantColTest.class,
		RedundantFKTest.class })
public final class PatternsTestSuite {

	private static final String PREFIX = "testdb_";

	public static void cleanRepository() throws NotFoundException, IntegrityException {

		for (char c = 'a'; c < 'z'; c++) {
			if (Schema.exists(PREFIX + c)) {
				Schema.getSchema(PREFIX + c).remove();
			}

			for (int i = 1; i <= 9; i++) {
				if (Schema.exists(PREFIX + c + Integer.toString(i))) {
					Schema.getSchema(PREFIX + c + Integer.toString(i)).remove();
				}
			}
		}
	}

	private PatternsTestSuite() {
	}

}
